{function url url='' item=[]}{strip}
    {if is_array($url)}
        {if $url[1] && $url.parse && $item}
            {foreach $url.parse as $key}
            {if !$url[1].$key}continue{/if}
            {$url[1].$key=$item.{$url[1].$key}}
            {/foreach}
        {/if}
        {url($url[0],$url[1]|default:[],$url[2]|default:true)}
    {else}
        {$url}
    {/if}
{strip}{/function}

{function furl url=''}{strip}
	{if $url}
   		{if strpos($url,'http://')===false && strpos($url,'https://')===false}
        	{if $url[0]=='/'}{$url=substr($url,1)}{/if}
        	{$url=$root|cat:$url}
        {/if}
       	{$url}
    {/if}    
{/strip}{/function}

{function name=menu_link id=0}{strip}
{$d_d=menu($id)}
{if !$d_d}
    #
{else}
    {if $d_d.type=='Exlink'}
        {call furl url=$d_d.ex_link}
    {else}
        {$alias=trim(menu($id,'alias'))}
        {if !$alias}
            {url($d_d.type|cat:'/show',['menu_id'=>$id])}
        {else}
            {$root}{$alias}.{config('url_html_suffix')}
        {/if}
    {/if}
{/if}
{/strip}{/function}
